package pl.gpms.server.persistance.dao;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import pl.gpms.client.dto.EstimateDTO;
import pl.gpms.server.persistance.map.Estimate;

public class EstimateDao implements Serializable {

	private static final long serialVersionUID = 1L;
	
	public EstimateDTO createEstimateDTO(Estimate estimate) {
		ObjectsDao objectDao = new ObjectsDao();
		DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
		
		return new EstimateDTO( formatter.format(estimate.getEstDate()), 
				                objectDao.createObjectsDTO(estimate.getEstimateObject()), 
				                estimate.getResult(), 
				                estimate.getId());
	}
	
}
